// JavaScript Document

function showMenu(id_menu){
var my_menu = document.getElementById(id_menu);
if(my_menu.style.display=="none" || my_menu.style.display==""){
	my_menu.style.display="block";
	} else { 
	my_menu.style.display="none";
	}
}

function swapImage(idStatus){
	if(idStatus==0){
		document.arrow_profile.src ="../images/arrow_hover.png";
	} else if(idStatus==1){
		document.arrow_profile.src ="../images/arrow_select.png";
	} else if(idStatus==2){
		document.arrow_profile.src ="../images/arrow.png";
	}
}

function showTab(obj,shdiv)
{
	for(var i=0;i<4;i++)
	{
		if(document.getElementById("a"+i))
		{
			document.getElementById("a"+i).style.display='none';
			document.getElementById("tab"+i).className='';
		}
		else
		{
			document.getElementById(obj).className='selected';
			document.getElementById(shdiv).style.display='block';
		}	
	}		
}
		
// top menu js start // Added by Pankaj

// define id of all menu container div
var menu = new Array("home","product","search","transaction","reviews","bookmarks","search","contact");		//JS menu collection array
var m = 0;
var isMenuOpened = "";
var menuStatus = "closed";
var mS = 1;

function hideMenus()
{
	for(m=0;m<menu.length;m++)
	{
		try{
			document.getElementById('mnu_' + menu[m]).style.display = "none";
			document.getElementById('mnu_' + menu[m]).style.marginLeft = "0px";
			document.getElementById('img_' + menu[m]).src = "http://jectly.com/assets/images/dwnArrow.jpg";
		}catch(Ex){}
	}
	//menuStatus = "closed";
}

function showMenu(mnu,xPos)
{
	hideMenus();
	if(isMenuOpened != mnu)
	{
		try{
		document.getElementById('mnu_' + mnu).style.display = "block";
		document.getElementById('mnu_' + mnu).style.marginLeft = xPos + "px";
		document.getElementById('img_' + mnu).src = "http://jectly.com/assets/images/upArrow.jpg";
		menuStatus = "opened";
		mS = mS + 1;
		}catch(Ex){}
		isMenuOpened = mnu;
	}
	else
	{
		isMenuOpened = "";
		menuStatus = "closed";
	}
}

function initMenu()
{
	//alert(menuStatus + "\n" + mS);
	if(menuStatus=="opened" && mS==1) {hideMenus();isMenuOpened="";}
	mS = 1;
}

function fillSearch(txt)
{
	hideMenus();
	isMenuOpened = "";
	try{
	document.getElementById("searchType").value = txt;
	document.getElementById("txt_searchType").innerHTML = txt;
	}catch(Ex){}
}

function fillOption(txt,groupID)
{
	hideMenus();
	isMenuOpened = "";
	try{
	document.getElementById(groupID).value = txt;
	document.getElementById("txt_"+groupID).innerHTML = txt;
	}catch(Ex){}
}

//alert(navigator.appName);
window.onload = function (){hideMenus();};
document.onclick = function (){initMenu();};

/*Opera fixes*/
window.onload = function (){
if(navigator.appName=="Opera" || navigator.appName=="Netscape") minWidth();
};


function minWidth()
{
	if(window.document.body.clientWidth<800)
		document.getElementById("body").style.width='800px';
	else
		document.getElementById("body").style.width='100%';
		
	setTimeout("minWidth()",500);
}

function showSearchTab(tabID)
{
	if(tabID==1)
	{
		document.getElementById("search_tab1").className = "searchTab_active";
		document.getElementById("search_box1").style.display = "block";
		
		document.getElementById("search_tab2").className = "searchTab";
		document.getElementById("search_box2").style.display = "none";
	}
	else
	{
		document.getElementById("search_tab2").className = "searchTab_active";
		document.getElementById("search_box2").style.display = "block";
		
		document.getElementById("search_tab1").className = "searchTab";
		document.getElementById("search_box1").style.display = "none";
	}
}

function changeBgColor(obj,colClass)
{
	obj.className = obj.className + " " + colClass;
}

function changeBgColors(obj,color)
{
	obj.style.backgroundColor = color;
}

var thisTab = 1;
function headingRollover(colID,pageID)
{
	var obj = document.getElementById("tab" + pageID.toString());

	if(pageID!=thisTab)
	{
		if(colID==1)
		{
			obj.style.backgroundColor = "#008080";
			obj.style.color = "#FFFFFF";
		}
		else
		{
			obj.style.backgroundColor = "#FFFFFF";
			obj.style.color = "#000000";
		}
	}
}

function headingClick(pageID)
{
	thisTab = pageID;
	try
	{
	document.getElementById("tab1").style.backgroundColor = "#FFFFFF";
	document.getElementById("tab2").style.backgroundColor = "#FFFFFF";
	document.getElementById("tab3").style.backgroundColor = "#FFFFFF";
	}
	catch(e)
	{
	}
	document.getElementById("tab" + thisTab.toString()).style.backgroundColor = "#008080";

	try
	{
	document.getElementById("tab1").style.color = "#000000";
	document.getElementById("tab2").style.color = "#000000";
	document.getElementById("tab3").style.color = "#000000";
	}
	catch(e)
	{
	}
	document.getElementById("tab" + thisTab.toString()).style.color = "#FFFFFF";
	
	try{
	document.getElementById("page1").style.display = "none";
	document.getElementById("page2").style.display = "none";
	document.getElementById("page3").style.display = "none";
	}catch(e)
	{
	}
	
	document.getElementById("page" + pageID.toString()).style.display = "";
	headingRollover(obj,2,pageID);
}

var Sub = new Array(8);
Sub[0]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Web</option><option class='leftt' value='1'>Graphics</option><option class='leftt' value='2'>Logo/Icon/Banners</option><option class='leftt' value='3'>Character</option><option class='leftt' value='4'>Concept/Interface</option><option class='leftt' value='5'>3D</option><option class='leftt' value='6'>Other</option></select>";
Sub[1]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Java</option><option class='leftt' value='1'>PHP</option><option class='leftt' value='2'>Perl</option><option class='leftt' value='3'>Ruby/Python</option><option class='leftt' value='4'>Flash/RIA</option><option class='leftt' value='5'>C/C++</option><option class='leftt' value='6'>ASP/ET/Delphi</option><option class='leftt' value='7'>Javascript</option><option class='leftt' value='8'>XML/XHTML/CSS</option></select>";
Sub[2]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Small Web</option><option class='leftt' value='1'>Medium Web</option><option class='leftt' value='2'>Large Web</option><option class='leftt' value='3'>Desktop</option><option class='leftt' value='4'>Mobile</option><option class='leftt' value='5'>Garre</option><option class='leftt' value='6'>Other</option></select>";
Sub[3]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>System Admin</option><option class='leftt' value='1'>Server Hosting</option><option class='leftt' value='2'>Project Management</option><option class='leftt' value='3'>Technical issues</option><option class='leftt' value='4'>Skill up</option><option class='leftt' value='5'>Link/SEO</option><option class='leftt' value='6'>Helper</option><option class='leftt' value='7'>Other</option></select>";
Sub[4]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Translation</option><option class='leftt' value='1'>Copywriting</option><option class='leftt' value='2'>Blog/Contents</option><option class='leftt' value='3'>Other</option></select>";
Sub[5]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Sound Effect</option><option class='leftt' value='1'>Music</option><option class='leftt' value='2'>Movie</option><option class='leftt' value='3'>Voice</option><option class='leftt' value='4'>Other</option></select>";
Sub[6]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Accounting </option><option class='leftt' value='1'>Tax management</option><option class='leftt' value='2'>Other</option></select>";
Sub[7]="<select class='input w175' name='subgroup' multiple='multiple' size='8' onchange='selectOne(this)'><option class='leftt' value='0'>Business</option><option class='leftt' value='1'>Venture</option><option class='leftt' value='2'>Partnership</option><option class='leftt' value='3'>Marketing/Research</option><option class='leftt' value='4'>Other</option></select>";

function selectSub(obj)
{
	var sel = "";
	var k = 0;
	var l = -1;
	for(k=0;k<obj.length;k++)
	{
		if(obj[k].selected) l = k;
	}

	if(l<0)
	{
		document.getElementById('sub1').style.visibility = "hidden";
		document.getElementById('sub2').style.visibility = "hidden";	
	}
	else
	{
		
		document.getElementById('sub1').style.visibility = "";
		document.getElementById('sub2').innerHTML = Sub[l];
		document.getElementById('sub2').style.visibility = "";
		obj.selectedIndex = l;
	}
}

function selectOne(obj)
{
	var sel = "";
	var k = 0;
	var l = -1;
	for(k=0;k<obj.length;k++)
	{
		if(obj[k].selected) l = k;
	}

	if(l>=0) obj.selectedIndex = l;
}

function showHint(obj,val,mode)
{
	if(mode==1)
	{
		if(obj.value==val || obj.value=='') obj.value="";
	}
	else
	{
		if(obj.value=='') obj.value=val;
	}
}